import re
import sqlite3
class TorrentzapPipeline(object):
    def process_item(self, item, spider):
        conn = sqlite3.connect("torrentzap.sqlite")
        cursor = conn.cursor()
        #sql1="DROP TABLE IF EXISTS wco"
	    # define the fields for your item here like:
        sql2="CREATE TABLE IF NOT EXISTS torrentzap(title text, turl text, size text, seeds text, leaches text, addedDate text, url text)"
        cursor.execute(sql2)
        title =item['title']
        turl =item['turl']		
        size =item['size']			
        seeds =item['seeds']#.repalce("-","0")
        leaches =item['leaches']#.replace("-","0")				
        addedDate =item['addedDate']		
        url =item['url']			
        sql3="INSERT INTO torrentzap(title, turl, size, seeds, leaches, addedDate, url) values('"+ title+"','"+turl+"','"+size+"','"+seeds+"','" +leaches+"','"+ addedDate+"','"+ url+"')"
        cursor.execute(sql3)
        conn.commit()
        conn.close()
        return item

				
